package collection2;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

public class CollectionToArray1 {
    public static void main(String[] args) {
        Collection<String> c1 = new ArrayList<>();
        c1.add("one");
        c1.add("two");
        c1.add("three");
        c1.add("four");
        c1.add("fvie");
        System.out.println(c1);

        String[]array = c1.toArray(new String[3]);
        System.out.println(Arrays.toString(array));

        String[]array1 = c1.toArray(new String[8]);
        System.out.println(Arrays.toString(array1));

        String[]array2 = c1.toArray(new String[c1.size()]);
        System.out.println(Arrays.toString(array2));
    }
}
